home *** CD-ROM | disk | FTP | other *** search
/ Dream 55 / Amiga_Dream_55.iso / RISCOS / APPS / TEXT / PS / KIT-PS.ZIP / Kit PS / !PSUtils / pl / fixtpps < prev    next >
Text File  |  1997-01-24  |  734b  |  36 lines

  1. @rem = '-*- Perl -*-
  2. @echo off
  3. perl -S %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
  4. goto endofperl
  5. ';
  6.  
  7. # fixtpps: fix tpscript document to work with PSUtils
  8. #
  9. # Copyright (C) Angus J. C. Duggan 1991-1995
  10. # See file LICENSE for details.
  11.  
  12. $nesting = 0;
  13. $header = 1;
  14.  
  15. while (<>) {
  16.    if (/^%%Page:/ && $nesting == 0) {
  17.       print $_;
  18.       print "save home\n";
  19.       $header = 0;
  20.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
  21.       print $_;
  22.       $nesting++;
  23.    } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
  24.       print $_;
  25.       $nesting--;
  26.    } elsif (/save home/) {
  27.       s/save home//;
  28.       print $_;
  29.    } elsif (!$header || (! /^save$/ && ! /^home$/)) {
  30.       print $_;
  31.    }
  32. }
  33. __END__
  34. :endofperl
  35.  
  36.